//
//
//
//
//
//
//
//
//
//
//
import abstractButton from '../internal/abstractButton'
import icon from '../icon'
import tooltip from '../tooltip'
export default {
name: 'mu-icon-button',
props: {
icon: {
type: String
},
iconClass: {
type: String,
default: ''
},
href: {
type: String,
default: ''
},
target: {
type: String
},
disabled: {
type: Boolean,
default: false
},
keyboardFocused: {
type: Boolean,
default: false
},
tooltip: {
type: String
},
tooltipPosition: {
type: String,
default: 'bottom-center'
},
touch: {
type: Boolean,
default: false
}
},
computed: {
verticalPosition () {
const tooltipPosition = this.tooltipPosition.split('-')
return tooltipPosition[0]
},
horizontalPosition () {
const tooltipPosition = this.tooltipPosition.split('-')
return tooltipPosition[1]
}
},
data () {
return {
tooltipShown: false,
tooltipTrigger: null
}
},
methods: {
handleClick (e) {
this.$emit('click', e)
},
handleHover (event) {
this.tooltipShown = true
this.$emit('hover', event)
},
handleHoverExit (event) {
this.tooltipShown = false
this.$emit('hoverExit', event)
},
handleKeyboardFocus (isFocus) {
this.$emit('keyboardFocus', isFocus)
},
handleStop (event) {
event.stopPropagation() // 防止list中使用导致波纹点击重复
}
},
mounted () {
this.tooltipTrigger = this.$el
},
components: {
'abstract-button': abstractButton,
icon,
tooltip
}
}
|